// 代码实现配置数据后自动生成
// function init_ops_panel(ops_title) {
//     let ops_url = '/easy_ui/test_menu_data'
//     let ops_columns = [[
//         {field: 'itemid', title: 'Item ID', width: 80},
//         {field: 'productid', title: 'Product ID', width: 120},
//         {field: 'listprice', title: 'List Price', width: 80, align: 'right'},
//         {field: 'unitcost', title: 'Unit Cost', width: 80, align: 'right'},
//         {field: 'attr1', title: 'Attribute', width: 250},
//         {field: 'status', title: 'Status', width: 60, align: 'center'}
//     ]]
//     let select_data = [
//         {name: "new", value: "select_ops"},
//         {name: "sport", value: "sport_ops"},
//     ]
//     init_datagrid("dg", ops_title, ops_url, ops_columns)
//     init_searchbox("ss", "mm", "dg", select_data)
// }
//
//
//
// function init_service_panel(service_title) {
//     let service_url = '/easy_ui/test_menu_data'
//     let service_columns = [[
//         {field: 'itemid', title: 'Item ID', width: 80},
//         {field: 'productid', title: 'Product ID', width: 120},
//         {field: 'listprice', title: 'List Price', width: 80, align: 'right'},
//         {field: 'unitcost', title: 'Unit Cost', width: 80, align: 'right'},
//         {field: 'attr1', title: 'Attribute', width: 250},
//         {field: 'status', title: 'Status', width: 60, align: 'center'}
//     ]]
//     let select_data = [
//         {name: "new", value: "select_service"},
//         {name: "sport", value: "sport_service"},
//     ]
//     init_datagrid("dg_service", service_title, service_url, service_columns)
//     init_searchbox("ss_service", "mm_service", "dg_service", select_data)
// }

function add_ops_dialog(panel_parent_id, dialog_id, url, title, buttons = null) {
    let dialog = $("#" + dialog_id)
    if (dialog.length > 0) {
        dialog.attr('src', $('#iframe').attr('src'));
        dialog.parent().show()
        return
    }
    let dialog_str = "<iframe id=\"" + dialog_id + "\">Dialog Content.</iframe>"
    $("#" + panel_parent_id).append(dialog_str);
    let dialog_data = {
        title: title,
        width: 500,
        height: 500,
        closed: false,
        cache: false,
        modal: true
    }
    if (buttons) {
        dialog_data.buttons = buttons
    }
    $('#' + dialog_id).dialog(dialog_data);
    $('#' + dialog_id).attr("src", url);

}